<%@ Page Title="Employee Details" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="_EmployeeDetails.aspx.cs" Inherits="AdventureWorks.Client.Web.EmployeeDetails" %>

<%@ Import Namespace="AdventureWorks.Client.Objects" %>
<%@ Register src="~/Errors.ascx" tagname="Errors" tagprefix="asp" %>
<%@ Register tagprefix="asp" Namespace="System.Web.UI.WebControls" %>
<asp:Content xmlns:rest="http://www.xomega.net/rest" xmlns:asp="clr-namespace:System.Web.UI.WebControls" ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
   <h2>Employee Details</h2>
   <div>
      <asp:Errors ID="errors" runat="server"></asp:Errors>
   </div>
   <asp:Panel runat="server" ID="pnlMain">
      <table style="width: 100%;">
         <tr>
            <td class="fieldColumn">
               <div class="field">
                  <asp:Label runat="server" ID="lblTemporaryKey" CssClass="label" Text="Temporary Key:"></asp:Label>
                  <asp:TextBox LabelID="lblTemporaryKey" ID="ctlTemporaryKey" Property="<%# EmployeeObject.TemporaryKey %>" runat="server" CssClass="integer"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblEmployeeId" CssClass="label" Text="Employee Id:"></asp:Label>
                  <asp:HyperLink LabelID="lblEmployeeId" ID="ctlEmployeeId" Property="<%# EmployeeObject.EmployeeId %>" runat="server" NavigateUrl="~/_EmployeeDetails.aspx?EmployeeId={value}"></asp:HyperLink>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblNationalIDNumber" CssClass="label" Text="National ID Number:"></asp:Label>
                  <asp:TextBox LabelID="lblNationalIDNumber" ID="ctlNationalIDNumber" Property="<%# EmployeeObject.NationalIDNumber %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblLogin" CssClass="label" Text="Login:"></asp:Label>
                  <asp:TextBox LabelID="lblLogin" ID="ctlLogin" Property="<%# EmployeeObject.Login %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblManager" CssClass="label" Text="Manager:"></asp:Label>
                  <asp:HyperLink LabelID="lblManager" ID="ctlManager" Property="<%# EmployeeObject.Manager %>" runat="server" NavigateUrl="~/_EmployeeDetails.aspx?EmployeeId={value}"></asp:HyperLink>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblTitle" CssClass="label" Text="Title:"></asp:Label>
                  <asp:TextBox LabelID="lblTitle" ID="ctlTitle" Property="<%# EmployeeObject.Title %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblBirthDate" CssClass="label" Text="Birth Date:"></asp:Label>
                  <asp:TextBox LabelID="lblBirthDate" ID="ctlBirthDate" Property="<%# EmployeeObject.BirthDate %>" runat="server" CssClass="date"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblMaritalStatus" CssClass="label" Text="Marital Status:"></asp:Label>
                  <asp:DropDownList LabelID="lblMaritalStatus" ID="ctlMaritalStatus" Property="<%# EmployeeObject.MaritalStatus %>" runat="server"></asp:DropDownList>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblGender" CssClass="label" Text="Gender:"></asp:Label>
                  <asp:DropDownList LabelID="lblGender" ID="ctlGender" Property="<%# EmployeeObject.Gender %>" runat="server"></asp:DropDownList>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblHireDate" CssClass="label" Text="Hire Date:"></asp:Label>
                  <asp:TextBox LabelID="lblHireDate" ID="ctlHireDate" Property="<%# EmployeeObject.HireDate %>" runat="server" CssClass="date"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblSalariedFlag" CssClass="label" Text="Salaried Flag:"></asp:Label>
                  <asp:CheckBox LabelID="lblSalariedFlag" ID="ctlSalariedFlag" Property="<%# EmployeeObject.SalariedFlag %>" runat="server"></asp:CheckBox>
               </div>
            </td>
            <td class="fieldColumn">
               <div class="field">
                  <asp:Label runat="server" ID="lblVacationHours" CssClass="label" Text="Vacation Hours:"></asp:Label>
                  <asp:TextBox LabelID="lblVacationHours" ID="ctlVacationHours" Property="<%# EmployeeObject.VacationHours %>" runat="server" CssClass="integer"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblSickLeaveHours" CssClass="label" Text="Sick Leave Hours:"></asp:Label>
                  <asp:TextBox LabelID="lblSickLeaveHours" ID="ctlSickLeaveHours" Property="<%# EmployeeObject.SickLeaveHours %>" runat="server" CssClass="integer"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblCurrentFlag" CssClass="label" Text="Current Flag:"></asp:Label>
                  <asp:CheckBox LabelID="lblCurrentFlag" ID="ctlCurrentFlag" Property="<%# EmployeeObject.CurrentFlag %>" runat="server"></asp:CheckBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblRowguid" CssClass="label" Text="Rowguid:"></asp:Label>
                  <asp:TextBox LabelID="lblRowguid" ID="ctlRowguid" Property="<%# EmployeeObject.Rowguid %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblModifiedDate" CssClass="label" Text="Modified Date:"></asp:Label>
                  <asp:TextBox LabelID="lblModifiedDate" ID="ctlModifiedDate" Property="<%# EmployeeObject.ModifiedDate %>" runat="server" CssClass="datetime"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblFirstName" CssClass="label" Text="First Name:"></asp:Label>
                  <asp:TextBox LabelID="lblFirstName" ID="ctlFirstName" Property="<%# ContactObject.FirstName %>" ChildObject="<%# EmployeeObject.Contact %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblMiddleName" CssClass="label" Text="Middle Name:"></asp:Label>
                  <asp:TextBox LabelID="lblMiddleName" ID="ctlMiddleName" Property="<%# ContactObject.MiddleName %>" ChildObject="<%# EmployeeObject.Contact %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblLastName" CssClass="label" Text="Last Name:"></asp:Label>
                  <asp:TextBox LabelID="lblLastName" ID="ctlLastName" Property="<%# ContactObject.LastName %>" ChildObject="<%# EmployeeObject.Contact %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblEmailAddress" CssClass="label" Text="Email Address:"></asp:Label>
                  <asp:TextBox LabelID="lblEmailAddress" ID="ctlEmailAddress" Property="<%# ContactObject.EmailAddress %>" ChildObject="<%# EmployeeObject.Contact %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblPhone" CssClass="label" Text="Phone:"></asp:Label>
                  <asp:TextBox LabelID="lblPhone" ID="ctlPhone" Property="<%# ContactObject.Phone %>" ChildObject="<%# EmployeeObject.Contact %>" runat="server"></asp:TextBox>
               </div>
            </td>
         </tr>
         <tr>
            <td colspan="2">
               <asp:Label runat="server" ID="lbllblPayHistory" CssClass="label" Text="Pay History:"></asp:Label>
               <asp:GridView runat="server" ID="gridPayHistory" ChildObject="<%# EmployeeObject.PayHistory %>">
                  <Columns>
                     <asp:TemplateField HeaderText="Pay Frequency">
                        <ItemTemplate>
                           <asp:Label runat="server" ID="fldPayFrequency" Property="<%# EmployeePayHistory.PayFrequency %>"></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                           <asp:DropDownList runat="server" ID="fldPayFrequency" Property="<%# EmployeePayHistory.PayFrequency %>"></asp:DropDownList>
                        </EditItemTemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="Rate">
                        <ItemTemplate>
                           <asp:Label runat="server" ID="fldRate" Property="<%# EmployeePayHistory.Rate %>"></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                           <asp:TextBox runat="server" CssClass="decimal" ID="fldRate" Property="<%# EmployeePayHistory.Rate %>"></asp:TextBox>
                        </EditItemTemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="Rate Change Date">
                        <ItemTemplate>
                           <asp:Label runat="server" ID="fldRateChangeDate" Property="<%# EmployeePayHistory.RateChangeDate %>"></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                           <asp:TextBox runat="server" CssClass="datetime" ID="fldRateChangeDate" Property="<%# EmployeePayHistory.RateChangeDate %>"></asp:TextBox>
                        </EditItemTemplate>
                     </asp:TemplateField>
                     <asp:CommandField ShowEditButton="true" ShowDeleteButton="true" ShowInsertButton="true"></asp:CommandField>
                  </Columns>
                  <EmptyDataTemplate>
                     <asp:LinkButton runat="server" ID="btnNew" Text="New" CommandName="New"></asp:LinkButton>
                  </EmptyDataTemplate>
               </asp:GridView>
            </td>
         </tr>
      </table>
   </asp:Panel>
   <div>
      <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" CssClass="saveButton"></asp:Button>
      <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click" CssClass="deleteButton" Enabled="false" OnClientClick="return confirm('Are you sure you want to delete this object?\nThis action cannot be undone.')"></asp:Button>
      <asp:Button ID="btnClose" runat="server" Text="Close" OnClick="btnClose_Click" CssClass="closeButton"></asp:Button>
   </div>
</asp:Content>